<template>
  <n-card :bordered="false" class="proCard">
    <div class="result-box">
      <n-result
        :status="result.status"
        :title="result.title"
        :description="result.description"
      >
        <div class="result-box-extra">
          <p>{{ result.content }}</p>
          <span style="float: right;">
            处理时间：{{ formatToDateTime(result.createTime) }}
          </span>
        </div>
        <template #footer>
          <div class="flex justify-center mb-4">
            <n-space align="center">
              <n-button type="info" @click="router.push('/')">回到首页</n-button>
              <n-button type="info" @click="router.push('/login')">回到登录页</n-button>
            </n-space>
          </div>
        </template>
      </n-result>
    </div>
  </n-card>
</template>
<script lang="ts" setup>
import { computed, ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useThemeVars } from 'naive-ui';
import { ResultType, getInfo } from "@/views/result/ResultStorage";
import { formatToDateTime } from "@/utils/dateUtil";

const router = useRouter();
const themeVars = useThemeVars();

const result = ref<ResultType>(getInfo());

onMounted(() => {});

const getTableHeaderColor = computed(() => {
  return themeVars.value.tableHeaderColor;
});
</script>
<style lang="less" scoped>
  .result-box {
    width: 72%;
    margin: 0 auto;
    text-align: center;
    padding-top: 5px;

    &-extra {
      padding: 24px 40px;
      text-align: left;
      background: v-bind(getTableHeaderColor);
      border-radius: 4px;
    }
  }
</style>
